package javase.chixing.thread_producer_and_consumer_model;

class Consumer extends Thread{
    private Shop shop;

    public Consumer(Shop shop) {
        this.shop = shop;
    }

    @Override
    public void run() {
        System.out.println(getName()+"开始消费...");
        while (true){
            try {
                Thread.sleep(500);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            shop.itemsSold();
        }
    }
}
